# $ZEL: Makefile,v 1.7 2006/11/13 12:40:38 wuestner Exp $

KERNVER := $(shell uname -r)

.PHONY: driver

driver:
	make -C /lib/modules/$(KERNVER)/build SUBDIRS=$(shell pwd) modules

install:
	make -C /lib/modules/$(KERNVER)/build SUBDIRS=$(shell pwd) modules_install

#clean:
#	make -C /lib/modules/$(KERNVER)/build SUBDIRS=$(shell pwd) clean
clean:
	-rm *.o *.ko .*.o.cmd .*.ko.cmd *.mod.c Module.symvers
	-rm -r .tmp_versions

MODULENAME := sis1100

ifndef src
    src:=$(shell pwd)
endif

SOURCES:=$(notdir $(wildcard $(src)/*.c))
sis1100-objs := $(patsubst %.c, %.o, $(filter-out %netbsd.c, $(SOURCES)))

ifneq (,$(findstring 2.6.,$(KERNVER)))

EXTRA_CFLAGS += -DMODULENAME=$(MODULENAME)

obj-m += sis1100.o
#obj-$(CONFIG_SIS1100) += sis1100.o

else

modules: sis1100.o

sis1100.o: $(sis1100-objs)
	$(LD) -r -o $@ $^

endif
